//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

namespace Mindscape.BackgroundMotion.Core
{
  /// <summary>
  /// Static class which allows for brokering of context items regardless of our current context
  /// </summary>
  public static class ContextItemsBroker
  {
    /// <summary>
    /// Gets an item from the container based on a key
    /// </summary>
    /// <param name="key">The key of the item.</param>
    public static T GetItem<T>(string key)
    {
      return ServiceLocator.Get<IContextItems>().GetItem<T>(key);
    }

    /// <summary>
    /// Sets an item in the container
    /// </summary>
    /// <param name="key">The key of the item.</param>
    /// <param name="value">The value of the item.</param>
    public static void SetItem<T>(string key, T value)
    {
      ServiceLocator.Get<IContextItems>().SetItem(key, value);
    }

    /// <summary>
    /// Removes an item from the container
    /// </summary>
    /// <param name="key">The key of the item.</param>
    public static void RemoveItem(string key)
    {
      ServiceLocator.Get<IContextItems>().RemoveItem(key);
    }
  }
}